package com.epalmpay.service.management.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.epalmpay.entity.RoleButton;
import com.epalmpay.mapper.RoleButtonMapper;
import com.epalmpay.service.management.IRoleButtonService;
import com.epalmpay.util.UuidUtil;

@Service("roleButtonService") 
public class RoleButtonServiceImpl implements IRoleButtonService {
	
	
	@Resource  
    private RoleButtonMapper roleButtonMapper;

	@Override
	public void save(RoleButton roleButton) throws Exception {
		//通过(角色ID和按钮ID)获取数据
		RoleButton boleButton=roleButtonMapper.findById(roleButton);
		if(boleButton!=null){//判断关联表是否有数据 是:删除/否:新增
			roleButtonMapper.deleteByPrimaryKey(boleButton.getRbId());
		}else{
			roleButton.setRbId(UuidUtil.get32UUID()); 
			roleButtonMapper.insert(roleButton);
		}
	}

	@Override
	public RoleButton findById(RoleButton roleButton) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void delete(RoleButton roleButton) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<RoleButton> listAll() throws Exception {
		// TODO Auto-generated method stub
		return roleButtonMapper.selectAll();
	}

	@Override
	public List<RoleButton> listAllBrAndQxname(RoleButton roleButton) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	
	
	
	
}
